package com.huosu.commons.exception;

import com.huosu.commons.response.ApiErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义异常
 *
 * @author lyc
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class BaseException extends RuntimeException {

    private ApiErrorCode apiErrorCode;

    public BaseException(ApiErrorCode apiErrorCode) {
        super(apiErrorCode.getMsg());
        this.apiErrorCode = apiErrorCode;
    }

    public BaseException(ApiErrorCode apiErrorCode,String msg) {
        super(apiErrorCode.getMsg()+msg);
        this.apiErrorCode = apiErrorCode;
    }

    public BaseException(String msg) {
        //msg：提示信息；第二个参数：cause异常；第三个：是否允许suppressed异常；第四个：创建时打印错误
        super(msg,null,false,false);
    }
}
